package com.bdqn.qnnews.wemedia.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bdqn.qnnews.wemedia.entity.WmNewsMaterial;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 自媒体图文引用素材信息表 Mapper 接口
 * @author xlZhang
 * @since 2023-06-01
 */
@Mapper
public interface WmNewsMaterialMapper extends BaseMapper<WmNewsMaterial> {

    /**
     * 保存文章素材
     * @param materialIds 素材id列表
     * @param newsId 文章id
     * @param type 引用类型	0 内容引用	1 主图（封面）引用
        //@Insert({"<script>",
        //        "insert into wm_news_material(material_id,news_id,type) values ",
        //        "   <foreach collection='materialIds' item='mid' separator=','>",
        //        "       (#{mid},#{newsId},#{type})",
        //        "   </foreach>",
        //        "</script>"})
     */
    void insertBatch(@Param("materialIds") List<Long> materialIds,
                     @Param("newsId") Long newsId,
                     @Param("type") int type);
    
}